package net.comm.group.db;


import java.sql.ResultSet;
import java.sql.SQLException;


import net.comm.group.bean.BaseGroups;
import net.comm.oper.bean.Baseoperlog;
import net.comm.util.StringUtil;

import org.sakaiproject.db.api.SqlReader;

public class DbGroupsService implements SqlReader
{

	/**
	 * Read from the result one set of fields to create a Resource.
	 * 
	 * @param result
	 *        The Sql query result.
	 * @return The Resource object.
	 */
	public Object readSqlResultRecord(ResultSet result)
	{
		try
		{
			
			int  groupID = result.getInt(1);			//群组ID
			int  villageID = result.getInt(2);			//群组ID
			String  name = StringUtil.getValue(result.getString(3));			//群组名称
			String  subject = StringUtil.getValue(result.getString(4));			//群组主题
			int  firsort = result.getInt(5);			//
			int  secsort = result.getInt(6);			//
			int  thiSort = result.getInt(7);			//
			int  pic = result.getInt(8);				//
			int  work_location = result.getInt(9);		//所在省份
			int  work_sublocation = result.getInt(10);	//所在城市
			int  work_Area = result.getInt(11);			//所在区县
			int  joinNum = result.getInt(12);			//当前人数
			int  num = result.getInt(13);				//限定人数
			String  ctime = StringUtil.getValue(result.getString(14));				//
			int  userID = result.getInt(15);				//创建会员
			int  pepoleVal = result.getInt(16);			//人气值
			int  partakeVal = result.getInt(17);		//参与值
			int  contrVal = result.getInt(18);			//贡献值
			String  type = StringUtil.getValue(result.getString(19));				//类型
			int  useAlbumSize = result.getInt(20);		//相册容量
			int  albumSize = result.getInt(21);			//相册容量
			String  status = StringUtil.getValue(result.getString(22));				//
			String  mtime = StringUtil.getValue(result.getString(23));				//		

			// create the Resource from these fields
			return new BaseGroups(  groupID,  villageID,  name,  subject, firsort,  secsort,  thiSort,  pic,  work_location,
					 work_sublocation,  work_Area,  joinNum,  num, ctime,  userID,  pepoleVal,  partakeVal,
					 contrVal,  type,  useAlbumSize,  albumSize, status,  mtime );
		}
		catch (SQLException e)
		{
			return null;
		}
		
	}
}
